﻿using System;

namespace BuzzX8.Xmpp.StreamElements.Security
{
    public class TlsElement : StreamElement
    {
        public static readonly TlsElement Failure = new TlsElement("failure");
        public static readonly TlsElement Proceed = new TlsElement("proceed");
        public static readonly TlsElement StartTls = new TlsElement("starttls");
        
        private TlsElement(string name) : base(name, "", XmppNamespaces.Tls)
        { }

        public static bool operator ==(TlsElement response1, TlsElement response2)
        {
            return response1.Equals(response2);
        }

        public static bool operator !=(TlsElement response1, TlsElement response2)
        {
            return !response1.Equals(response2);
        }

        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            if (!(obj is TlsElement)) return false;

            return Name == ((TlsElement) obj).Name;
        }
    }
}
